/******************************************************************************/
/*                                 COPYRIGHT                                  */
/*          Copyright (C) 2013-2022 COOCAA Inc. All Rights Reserved.          */
/******************************************************************************/
/*                               MODIFY HISTORY                               */
/*  YYYYMMDD   OWNER               DESCRIPTION                                */
/*  20220801   Liang Quanqing      Init Version                               */
/*  20221011   Liang Quanqing      Feat new function.                         */
/*  20221011   Lin Xinwang         Feat new function.                         */
/******************************************************************************/

import cooApp, { Widget, ui, basicWidgets, ToastInfo, Positioned } from 'coolink-ts'
import { px } from '../base/func'

const {
    Icon,
    Container,
    Text,
} = basicWidgets;

const defaultToastInfo: ToastInfo = {
    position: {
        left: px(30),
        right: px(30),
        top: px(356),
    }
}

const toastInfo2: ToastInfo = {
    position: {
        left: px(30),
        right: px(30),
        top: px(356),
    }
}

export function showAutoHideToast(text: string) {
    cooApp.showToast(
        <Container row padding={px(10)} borderRadius={px(20)} justifyContent="center"
            alignItems="center" backgroundColor={0xb2000000}
            width={px(252)} height={(36)}
        >
            <Icon type="info_outline" size={px(12)} color={0xffffffff} margin={{ right: px(10) }} />
            <Text color={0xffffffff} text={text} size={12}></Text>
        </Container>
        , defaultToastInfo);
}

export function showAutoHideToast2(text: string) {
    cooApp.showToast(
        <Container row padding={px(10)} borderRadius={px(20)} justifyContent="center"
            alignItems="center" backgroundColor={0xb2000000}
            width={px(270)} height={px(90)}
        >
            <Text color={0xffffffff} text={text} size={16} wrap={true} width={px(250)}></Text>
        </Container>
        , toastInfo2);
}


